dd.event({
    init:function(){},
    fn:{
        event:function(o, scope)
        {
            var ef = {
                load:function(e){return {};},
                resize:function(e)
                {
                    var w = 0, h = 0;
                    if(window.innerWidth)
                    {
                        w = window.innerWidth;
                        h = window.innerHeight;
                    }
                    else
                    {
                        if(document.documentElement.clientWidth != 0)
                        {
                            w = document.documentElement.clientWidth;
                            h = document.documentElement.clientHeight;
                        }
                        else
                        {
                            w = document.body.clientWidth;
                            h = document.body.clientHeight;
                        }
                    }
                    return {
                        screen:{
                            width:w,
                            height:h
                        }
                    };
                },
                mouseover:function(e)
                {
                    if (e.which) var lb = (e.which == 1);
                    else if (e.button) var lb = (e.button == 0);
                    return {
                        mouse:{
                            left:lb
                            }
                        };
                },
                mouseout:function(e)
                {
                    return {
                        mouse:{
                            x:e.clientX,
                            y:e.clientY
                            }
                        };
                },
                mousemove:function(e)
                {
                    return {"win":"fail"};
                },
                mousedown:function(e)
                {
                    if (e.which) lb = (e.which == 1);
                    else if (e.button) lb = (e.button == 1);
                    return {
                        mouse:{left:lb}
                        };
                },
                mouseup:function(e)
                {
                    if (e.which) lb = (e.which == 1);
                    else if (e.button) lb = (e.button == 1);
                    return {
                        mouse:{left:lb}
                        };
                },
                keypress:function(e)
                {
                    var c = 0;
                    if (e.keyCode) c = e.keyCode;
                    else if (e.which) c = e.which;
                    
                    return {
                        key:{
                            code:c,
                            tab:c == 9,
                            enter:c == 13
                        }
                    };
                },
                keydown:function(e)
                {
                    var c = 0;
                    if (e.keyCode) c = e.keyCode;
                    else if (e.which) c = e.which;
                    
                    return {
                        key:{
                            code:c,
                            tab:c == 9,
                            enter:c == 13
                        }
                    };
                },
                keyup:function(e)
                {
                    var c = 0;
                    if (e.keyCode) c = e.keyCode;
                    else if (e.which) c = e.which;
                    
                    return {
                        key:{
                            code:c,
                            tab:c == 9,
                            enter:c == 13
                        }
                    };
                },
                focus:function(e)
                {
                    return {};
                },
                blur:function(e)
                {
                    return {};
                },
                click:function(e)
                {
                    return {"win":"fail"};
                }
            };
            // Get instance of the return  and place it below!
            var f = function(en, fn, s, ef, slf)
            {
                return function(ev)
                {
                    var scope = typeof(s) == "undefined" ? {} : s;
                    var e = (window.event) ? window.event : ev;
                    scope.self = slf;
                    var ex = ef[en].call(this, e);
                    for(var i in ex)
                    {
                        scope[i] = ex[i];
                    }
                    var r = fn.call(scope);
                    var d = en == "click" ? true : false;
                    if(typeof(r) == "undefined" ? d : !r)
                    {
                        e.cancelBubble = true;
                        if(e.stopPropagation) e.stopPropagation();
                        if(e.preventDefault){e.preventDefault();}else{e.returnValue = false;}
                    }
                };
            };
            for(var i in o)
            {
                var en = i.toLowerCase().match(/on(\w+)/)[1];
                dd(this.o).each(function(){
                    var ev = "event" in this ? this.event : {};
                    this.addEvent(i, o[i]);
                    if(en in {click:0})
                    {
                        this.self.addEventListener(en, f(en, o[i], scope, ef, this.self), true);
                    }
                });
            }
        }
    }
});